Skip to content

Add Laplacian filter kernel doctests - #114

Open
pruthvirajgojare-source wants to merge 2 commits into
S-AI-Projects:masterfrom
pruthvirajgojare-source:R23-T050
Open

pruthvirajgojare-source wants to merge 2 commits into
S-AI-Projects:masterfrom
pruthvirajgojare-source:R23-T050

Conversation

@pruthvirajgojare-source

@pruthvirajgojare-source pruthvirajgojare-source commented Nov 21, 2026 •

Copy link
Copy Markdown

Description

Adds doctests to my_laplacian demonstrating every supported kernel size with a small in-memory NumPy image. This exercises the valid filtering path and documents the existing invalid-kernel ValueError without relying on image files.

Related Issue

No related issue identified.
Fixes: N/A (no related issue)

Type of Change

  • Bug Fix
  • New Feature
  • UI/UX Improvement
  • Performance Improvement
  • Tests
  • Documentation
  • Refactoring / Maintenance
  • CI/CD

Changes Made

  • Added small-array doctest examples for ksize 1, 3, 5, and 7.
  • Retained and verified the invalid ksize=0 example, which raises ValueError: ksize must be in (1, 3, 5, 7).
  • Added baseline and final coverage notes to work/R23-T050/BASELINE.md.
  • Achieved 100% statement coverage for my_laplacian (6/6 statements).

Screenshots / Recordings

Not applicable; no UI changes.

Testing

  • The requested Python 3.12 command was attempted but uv rejected it because the repository requires Python >=3.15.
  • uv run --no-project --python 3.12 --with numpy --with opencv-python-headless --with pytest --with pytest-cov pytest digital_image_processing/filters/laplacian_filter.py --cov=digital_image_processing/filters --cov-report=term-missing — passed, 1 pytest item; my_laplacian coverage is 100%.
  • uv run --no-project --python 3.12 --with numpy --with opencv-python-headless --with pytest python -m doctest -v digital_image_processing/filters/laplacian_filter.py — passed. Summary: 6 tests in 2 items; 6 passed and 0 failed.
  • uvx ruff check digital_image_processing/filters/laplacian_filter.py — passed.
  • uvx ruff format --check digital_image_processing/filters/laplacian_filter.py — passed.

Checklist

  • I have tested my changes locally.
  • I have added or updated tests, if needed.
  • I have updated documentation, if needed.
  • I have followed the project's coding guidelines.
  • I have run the relevant tests and checks.
  • I have addressed previous review feedback, if applicable. (No review feedback received yet.)

Additional Notes

The coverage report for the entire file is 59% because the interactive __main__ image-display example (lines 81–95) is not executed during doctests. Every executable statement within my_laplacian, including all four valid kernels and the invalid-kernel branch, is covered. A separate local upstream/R23-T050 branch contains only the code change; no upstream PR was opened.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant